import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { JqtPackageVO, JqtPackageForm, JqtPackageQuery } from '@/api/bus/jqtPackage/types';

/**
 * 查询套餐列表
 * @param query
 * @returns {*}
 */

export const listJqtPackage = (query?: JqtPackageQuery): AxiosPromise<JqtPackageVO[]> => {
  return request({
    url: '/bus/jqtPackage/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询套餐详细
 * @param id
 */
export const getJqtPackage = (id: string | number): AxiosPromise<JqtPackageVO> => {
  return request({
    url: '/bus/jqtPackage/' + id,
    method: 'get'
  });
};

/**
 * 新增套餐
 * @param data
 */
export const addJqtPackage = (data: JqtPackageForm) => {
  return request({
    url: '/bus/jqtPackage',
    method: 'post',
    data: data
  });
};

/**
 * 修改套餐
 * @param data
 */
export const updateJqtPackage = (data: JqtPackageForm) => {
  return request({
    url: '/bus/jqtPackage',
    method: 'put',
    data: data
  });
};

/**
 * 删除套餐
 * @param id
 */
export const delJqtPackage = (id: string | number | Array<string | number>) => {
  return request({
    url: '/bus/jqtPackage/' + id,
    method: 'delete'
  });
};

/**
 * 查询套餐列表
 * @param query
 * @returns {*}
 */

export const packageBuyList = (query?: JqtPackageQuery): AxiosPromise<JqtPackageVO[]> => {
  return request({
    url: '/bus/jqtPackage/packageBuyList',
    method: 'get',
    params: query
  });
};
